package com.zsh.console.webapp.action;

import com.zsh.console.security.UserAuthFilter;


public class HomeAction extends BaseAction{


    public String execute() {

        Object actionType = getSession().getAttribute(UserAuthFilter.SPRING_SECURITY_FORM_ACTIONTYPE_KEY);
        if(actionType != null) {
            if("launch".equalsIgnoreCase(actionType.toString())) {
                getSession().removeAttribute(UserAuthFilter.SPRING_SECURITY_FORM_ACTIONTYPE_KEY);
                return "launch";
            }
        }
        String[] loginUser = userManager.loginUser();
        String roles = loginUser[1];
        if(roles.contains("ADMIN")){
            getSession().setAttribute("isAdmin", "true");
        }else {
            getSession().setAttribute("isAdmin", "false");
        }
        return SUCCESS;
    }
}
